package tec;

public class TestEtatPassager {

	void testAssis() {

		final EtatPassager state = EtatPassager.ASSIS;
		assert(state.estAssis());
		assert(!(state.estExterieur()));
		assert(!(state.estDebout()));

	}

	void testDebout() {

		final EtatPassager state = EtatPassager.DEBOUT;
		assert(!(state.estAssis()));
		assert(!(state.estExterieur()));
		assert(state.estDebout());

	}

	void testExterieur() {

		final EtatPassager state = EtatPassager.DEHORS;
		assert(!(state.estAssis()));
		assert(state.estExterieur());
		assert(!(state.estDebout()));

	}

	void testInterieur() {
		final EtatPassager stateAssis = EtatPassager.ASSIS;
		final EtatPassager stateDebout = EtatPassager.DEBOUT;
		final EtatPassager stateDehors = EtatPassager.DEHORS;

		assert(stateAssis.estInterieur());
		assert(stateDebout.estInterieur());
		assert(!(stateDehors.estInterieur()));

	}

	public void lancer() {

		int nbTest = 0;
		System.out.println("Test de EtatPasssager:");

		System.out.print("."); nbTest++;
		testExterieur();
		System.out.print("."); nbTest++;
		this.testAssis();
		System.out.print("."); nbTest++;
		this.testDebout();
		System.out.print("."); nbTest++;
		this.testInterieur();

     	// De la meme maniere, appel aux autres methodes de test.

		System.out.println("OK (" + nbTest + ")");

	}

	private void jeVeuxVrai(boolean expr, String m) {
		assert expr
		: "\nECHEC jeVeuxVrai <" + m + ">";
	}

	private void jeVeuxFaux(boolean expr, String m) {
		assert !expr
		: "\nECHEC jeVeuxFaux <" + m + ">";
	}
}
